Repository navigation
Conversation
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
f7de9ed to
4f7a4ac
Compare
4f7a4ac to
9fec48b
Compare
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
9fec48b to
e14080b
Compare
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
e14080b to
cd2492c
Compare
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and has added suggestions.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and found no issues.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and found no issues.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and found no issues.
|
@mflatt Do you think I should move the code to where the typst renderer is located? Another related question: should I put test code in |
|
Would it make sense to have a general Maybe it would also make sense to detect changes to dependencies of the main document file. The For a test, I agree that it would be better to have a separate test module. |
e49162a to
58944f8
Compare
There was a problem hiding this comment.
Resyntax analyzed 7 files in this pull request and found no issues.
There was a problem hiding this comment.
Resyntax analyzed 1 file in this pull request and found no issues.
There was a problem hiding this comment.
Resyntax analyzed 12 files in this pull request and found no issues.
There was a problem hiding this comment.
Resyntax analyzed 16 files in this pull request and has added suggestions.
| (map (lambda (fn) | ||
| (let-values ([(base name dir?) (split-path fn)]) | ||
| (or (current-dest-name) name))) | ||
| files) |
There was a problem hiding this comment.
map-to-for: This map operation can be replaced with a for/list loop.
| (map (lambda (fn) | |
| (let-values ([(base name dir?) (split-path fn)]) | |
| (or (current-dest-name) name))) | |
| files) | |
| (for/list ([fn (in-list files)]) | |
| (define-values (base name dir?) (split-path fn)) | |
| (or (current-dest-name) name)) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (for/list ([fn (in-list files)])"
" (define-values (base name dir?) (split-path fn))"
" (or (current-dest-name) name))")
#:original-lines
'#(" (map (lambda (fn)"
" (let-values ([(base name dir?) (split-path fn)])"
" (or (current-dest-name) name)))"
" files)")
#:start-line 84)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:148:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.5/pkgs/resyntax/default-recommendations/loops/list-loopification.rkt:125:2 (for/list ((fn (in-list files))) (define-values (base name dir?) (split-path fn)) (or (current-dest-name) name))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:84:10 (map (lambda (fn) (let-values (((base name dir?) (split-path fn))) (or (current-dest-name) name))) files)>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | ||
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | ||
| [xr (get-xref)]) | ||
| (unless (xref? xr) | ||
| (raise-user-error | ||
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | ||
| (cdr mod+id) (car mod+id) xr)) | ||
| xr)) |
There was a problem hiding this comment.
let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | |
| [xr (get-xref)]) | |
| (unless (xref? xr) | |
| (raise-user-error | |
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) (car mod+id) xr)) | |
| xr)) | |
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) | |
| (define xr (get-xref)) | |
| (unless (xref? xr) | |
| (raise-user-error 'scribble | |
| "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) | |
| (car mod+id) | |
| xr)) | |
| xr) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (define get-xref (dynamic-require (car mod+id) (cdr mod+id)))"
" (define xr (get-xref))"
" (unless (xref? xr)"
" (raise-user-error 'scribble"
" \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id)"
" (car mod+id)"
" xr))"
" xr)")
#:original-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))]"
" [xr (get-xref)])"
" (unless (xref? xr)"
" (raise-user-error"
" 'scribble \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id) (car mod+id) xr))"
" xr))")
#:start-line 102)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:148:2>
#:new-syntax
#<syntax:.../resyntax/base.rkt:215:28 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) (define xr (get-xref)) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e...>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:102:18 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (let* ((get-xref (dynamic-require (car mod+id) (cdr mod+id))) (xr (get-xref))) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e" (cdr...>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)| (define multi-html:render-mixin | ||
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) |
There was a problem hiding this comment.
define-lambda-to-define: The define form supports a shorthand for defining functions.
| (define multi-html:render-mixin | |
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) | |
| (define (multi-html:render-mixin %) | |
| (html:render-multi-mixin (html:render-mixin %))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#("(define (multi-html:render-mixin %)"
" (html:render-multi-mixin (html:render-mixin %)))")
#:original-lines
'#("(define multi-html:render-mixin"
" (lambda (%) (html:render-multi-mixin (html:render-mixin %))))")
#:start-line 16)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:148:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.5/pkgs/resyntax/default-recommendations/function-definition-shortcuts.rkt:98:2 (define (multi-html:render-mixin %) (html:render-multi-mixin (html:render-mixin %)))>
#:original-syntax
#<syntax:scribble-lib/scribble/run.rkt:16:0 (define multi-html:render-mixin (lambda (%) (html:render-multi-mixin (html:render-mixin %))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/run.rkt>)
#:uses-universal-tagged-syntax? #f)| (if (sync/timeout 0.1 stop) | ||
| (void) | ||
| (loop (arm-evts (hash-keys watches) watches)))] |
There was a problem hiding this comment.
if-void-to-when-or-unless: This conditional expression can be replaced with a simpler, equivalent expression.
| (if (sync/timeout 0.1 stop) | |
| (void) | |
| (loop (arm-evts (hash-keys watches) watches)))] | |
| (unless (sync/timeout 0.1 stop) | |
| (loop (arm-evts (hash-keys watches) watches)))] |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (unless (sync/timeout 0.1 stop)"
" (loop (arm-evts (hash-keys watches) watches)))]")
#:original-lines
'#(" (if (sync/timeout 0.1 stop)"
" (void)"
" (loop (arm-evts (hash-keys watches) watches)))]")
#:start-line 85)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:148:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.5/pkgs/resyntax/default-recommendations/conditional-shortcuts.rkt:88:2 (unless (sync/timeout 0.1 stop) (loop (arm-evts (hash-keys watches) watches)))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/watch.rkt:85:7 (if (sync/timeout 0.1 stop) (void) (loop (arm-evts (hash-keys watches) watches)))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/watch.rkt>)
#:uses-universal-tagged-syntax? #f)There was a problem hiding this comment.
Resyntax analyzed 15 files in this pull request and has added suggestions.
There was a problem hiding this comment.
Resyntax analyzed 15 files in this pull request and found no issues.
1556c3f to
0b1a250
Compare
There was a problem hiding this comment.
Resyntax analyzed 16 files in this pull request and has added suggestions.
| (if (hash-has-key? graph m) | ||
| graph | ||
| (let ([imports (imports-of m)]) | ||
| (for/fold ([graph (hash-set graph m imports)]) | ||
| ([i (in-list imports)] #:when (local? i)) | ||
| (loop graph i))))))) |
There was a problem hiding this comment.
if-let-to-cond: cond with internal definitions is preferred over if with let, to reduce nesting
| (if (hash-has-key? graph m) | |
| graph | |
| (let ([imports (imports-of m)]) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] #:when (local? i)) | |
| (loop graph i))))))) | |
| (cond | |
| [(hash-has-key? graph m) graph] | |
| [else | |
| (define imports (imports-of m)) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] | |
| #:when (local? i)) | |
| (loop graph i))])))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (cond"
" [(hash-has-key? graph m) graph]"
" [else"
" (define imports (imports-of m))"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)]"
" #:when (local? i))"
" (loop graph i))]))))")
#:original-lines
'#(" (if (hash-has-key? graph m)"
" graph"
" (let ([imports (imports-of m)])"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)] #:when (local? i))"
" (loop graph i)))))))")
#:start-line 55)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/let-replacement/cond-let-replacement.rkt:47:2 (cond ((hash-has-key? graph m) graph) (else (define imports (imports-of m)) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/walk.rkt:55:6 (if (hash-has-key? graph m) graph (let ((imports (imports-of m))) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/walk.rkt>)
#:uses-universal-tagged-syntax? #f)| (define multi-html:render-mixin | ||
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) |
There was a problem hiding this comment.
define-lambda-to-define: The define form supports a shorthand for defining functions.
| (define multi-html:render-mixin | |
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) | |
| (define (multi-html:render-mixin %) | |
| (html:render-multi-mixin (html:render-mixin %))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#("(define (multi-html:render-mixin %)"
" (html:render-multi-mixin (html:render-mixin %)))")
#:original-lines
'#("(define multi-html:render-mixin"
" (lambda (%) (html:render-multi-mixin (html:render-mixin %))))")
#:start-line 16)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/function-definition-shortcuts.rkt:98:2 (define (multi-html:render-mixin %) (html:render-multi-mixin (html:render-mixin %)))>
#:original-syntax
#<syntax:scribble-lib/scribble/run.rkt:16:0 (define multi-html:render-mixin (lambda (%) (html:render-multi-mixin (html:render-mixin %))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/run.rkt>)
#:uses-universal-tagged-syntax? #f)| (map (lambda (fn) | ||
| (let-values ([(base name dir?) (split-path fn)]) | ||
| (or (current-dest-name) name))) | ||
| files) |
There was a problem hiding this comment.
map-to-for: This map operation can be replaced with a for/list loop.
| (map (lambda (fn) | |
| (let-values ([(base name dir?) (split-path fn)]) | |
| (or (current-dest-name) name))) | |
| files) | |
| (for/list ([fn (in-list files)]) | |
| (define-values (base name dir?) (split-path fn)) | |
| (or (current-dest-name) name)) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (for/list ([fn (in-list files)])"
" (define-values (base name dir?) (split-path fn))"
" (or (current-dest-name) name))")
#:original-lines
'#(" (map (lambda (fn)"
" (let-values ([(base name dir?) (split-path fn)])"
" (or (current-dest-name) name)))"
" files)")
#:start-line 78)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/loops/list-loopification.rkt:125:2 (for/list ((fn (in-list files))) (define-values (base name dir?) (split-path fn)) (or (current-dest-name) name))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:78:10 (map (lambda (fn) (let-values (((base name dir?) (split-path fn))) (or (current-dest-name) name))) files)>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | ||
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | ||
| [xr (get-xref)]) | ||
| (unless (xref? xr) | ||
| (raise-user-error | ||
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | ||
| (cdr mod+id) (car mod+id) xr)) | ||
| xr)) |
There was a problem hiding this comment.
let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | |
| [xr (get-xref)]) | |
| (unless (xref? xr) | |
| (raise-user-error | |
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) (car mod+id) xr)) | |
| xr)) | |
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) | |
| (define xr (get-xref)) | |
| (unless (xref? xr) | |
| (raise-user-error 'scribble | |
| "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) | |
| (car mod+id) | |
| xr)) | |
| xr) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (define get-xref (dynamic-require (car mod+id) (cdr mod+id)))"
" (define xr (get-xref))"
" (unless (xref? xr)"
" (raise-user-error 'scribble"
" \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id)"
" (car mod+id)"
" xr))"
" xr)")
#:original-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))]"
" [xr (get-xref)])"
" (unless (xref? xr)"
" (raise-user-error"
" 'scribble \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id) (car mod+id) xr))"
" xr))")
#:start-line 96)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:.../resyntax/base.rkt:215:28 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) (define xr (get-xref)) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e...>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:96:18 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (let* ((get-xref (dynamic-require (car mod+id) (cdr mod+id))) (xr (get-xref))) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e" (cdr...>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)0b1a250 to
f8aabf7
Compare
There was a problem hiding this comment.
Resyntax analyzed 15 files in this pull request and has added suggestions.
| (if (hash-has-key? graph m) | ||
| graph | ||
| (let ([imports (imports-of m)]) | ||
| (for/fold ([graph (hash-set graph m imports)]) | ||
| ([i (in-list imports)] #:when (local? i)) | ||
| (loop graph i))))))) |
There was a problem hiding this comment.
if-let-to-cond: cond with internal definitions is preferred over if with let, to reduce nesting
| (if (hash-has-key? graph m) | |
| graph | |
| (let ([imports (imports-of m)]) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] #:when (local? i)) | |
| (loop graph i))))))) | |
| (cond | |
| [(hash-has-key? graph m) graph] | |
| [else | |
| (define imports (imports-of m)) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] | |
| #:when (local? i)) | |
| (loop graph i))])))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (cond"
" [(hash-has-key? graph m) graph]"
" [else"
" (define imports (imports-of m))"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)]"
" #:when (local? i))"
" (loop graph i))]))))")
#:original-lines
'#(" (if (hash-has-key? graph m)"
" graph"
" (let ([imports (imports-of m)])"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)] #:when (local? i))"
" (loop graph i)))))))")
#:start-line 55)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/let-replacement/cond-let-replacement.rkt:47:2 (cond ((hash-has-key? graph m) graph) (else (define imports (imports-of m)) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/walk.rkt:55:6 (if (hash-has-key? graph m) graph (let ((imports (imports-of m))) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/walk.rkt>)
#:uses-universal-tagged-syntax? #f)| (define multi-html:render-mixin | ||
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) |
There was a problem hiding this comment.
define-lambda-to-define: The define form supports a shorthand for defining functions.
| (define multi-html:render-mixin | |
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) | |
| (define (multi-html:render-mixin %) | |
| (html:render-multi-mixin (html:render-mixin %))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#("(define (multi-html:render-mixin %)"
" (html:render-multi-mixin (html:render-mixin %)))")
#:original-lines
'#("(define multi-html:render-mixin"
" (lambda (%) (html:render-multi-mixin (html:render-mixin %))))")
#:start-line 16)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/function-definition-shortcuts.rkt:98:2 (define (multi-html:render-mixin %) (html:render-multi-mixin (html:render-mixin %)))>
#:original-syntax
#<syntax:scribble-lib/scribble/run.rkt:16:0 (define multi-html:render-mixin (lambda (%) (html:render-multi-mixin (html:render-mixin %))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/run.rkt>)
#:uses-universal-tagged-syntax? #f)| (map (lambda (fn) | ||
| (let-values ([(base name dir?) (split-path fn)]) | ||
| (or (current-dest-name) name))) | ||
| files) |
There was a problem hiding this comment.
map-to-for: This map operation can be replaced with a for/list loop.
| (map (lambda (fn) | |
| (let-values ([(base name dir?) (split-path fn)]) | |
| (or (current-dest-name) name))) | |
| files) | |
| (for/list ([fn (in-list files)]) | |
| (define-values (base name dir?) (split-path fn)) | |
| (or (current-dest-name) name)) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (for/list ([fn (in-list files)])"
" (define-values (base name dir?) (split-path fn))"
" (or (current-dest-name) name))")
#:original-lines
'#(" (map (lambda (fn)"
" (let-values ([(base name dir?) (split-path fn)])"
" (or (current-dest-name) name)))"
" files)")
#:start-line 78)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/loops/list-loopification.rkt:125:2 (for/list ((fn (in-list files))) (define-values (base name dir?) (split-path fn)) (or (current-dest-name) name))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:78:10 (map (lambda (fn) (let-values (((base name dir?) (split-path fn))) (or (current-dest-name) name))) files)>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | ||
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | ||
| [xr (get-xref)]) | ||
| (unless (xref? xr) | ||
| (raise-user-error | ||
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | ||
| (cdr mod+id) (car mod+id) xr)) | ||
| xr)) |
There was a problem hiding this comment.
let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | |
| [xr (get-xref)]) | |
| (unless (xref? xr) | |
| (raise-user-error | |
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) (car mod+id) xr)) | |
| xr)) | |
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) | |
| (define xr (get-xref)) | |
| (unless (xref? xr) | |
| (raise-user-error 'scribble | |
| "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) | |
| (car mod+id) | |
| xr)) | |
| xr) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (define get-xref (dynamic-require (car mod+id) (cdr mod+id)))"
" (define xr (get-xref))"
" (unless (xref? xr)"
" (raise-user-error 'scribble"
" \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id)"
" (car mod+id)"
" xr))"
" xr)")
#:original-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))]"
" [xr (get-xref)])"
" (unless (xref? xr)"
" (raise-user-error"
" 'scribble \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id) (car mod+id) xr))"
" xr))")
#:start-line 96)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:.../resyntax/base.rkt:215:28 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) (define xr (get-xref)) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e...>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:96:18 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (let* ((get-xref (dynamic-require (car mod+id) (cdr mod+id))) (xr (get-xref))) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e" (cdr...>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)We added a small even loop to monitor scribble file changes. We used `dynamic-rerequire` to reload related doc modules.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
f8aabf7 to
22d3701
Compare
There was a problem hiding this comment.
Resyntax analyzed 15 files in this pull request and has added suggestions.
| (if (hash-has-key? graph m) | ||
| graph | ||
| (let ([imports (imports-of m)]) | ||
| (for/fold ([graph (hash-set graph m imports)]) | ||
| ([i (in-list imports)] #:when (local? i)) | ||
| (loop graph i))))))) |
There was a problem hiding this comment.
if-let-to-cond: cond with internal definitions is preferred over if with let, to reduce nesting
| (if (hash-has-key? graph m) | |
| graph | |
| (let ([imports (imports-of m)]) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] #:when (local? i)) | |
| (loop graph i))))))) | |
| (cond | |
| [(hash-has-key? graph m) graph] | |
| [else | |
| (define imports (imports-of m)) | |
| (for/fold ([graph (hash-set graph m imports)]) | |
| ([i (in-list imports)] | |
| #:when (local? i)) | |
| (loop graph i))])))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (cond"
" [(hash-has-key? graph m) graph]"
" [else"
" (define imports (imports-of m))"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)]"
" #:when (local? i))"
" (loop graph i))]))))")
#:original-lines
'#(" (if (hash-has-key? graph m)"
" graph"
" (let ([imports (imports-of m)])"
" (for/fold ([graph (hash-set graph m imports)])"
" ([i (in-list imports)] #:when (local? i))"
" (loop graph i)))))))")
#:start-line 55)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/let-replacement/cond-let-replacement.rkt:47:2 (cond ((hash-has-key? graph m) graph) (else (define imports (imports-of m)) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/walk.rkt:55:6 (if (hash-has-key? graph m) graph (let ((imports (imports-of m))) (for/fold ((graph (hash-set graph m imports))) ((i (in-list imports)) #:when (local? i)) (loop graph i))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/walk.rkt>)
#:uses-universal-tagged-syntax? #f)| (define multi-html:render-mixin | ||
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) |
There was a problem hiding this comment.
define-lambda-to-define: The define form supports a shorthand for defining functions.
| (define multi-html:render-mixin | |
| (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) | |
| (define (multi-html:render-mixin %) | |
| (html:render-multi-mixin (html:render-mixin %))) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#("(define (multi-html:render-mixin %)"
" (html:render-multi-mixin (html:render-mixin %)))")
#:original-lines
'#("(define multi-html:render-mixin"
" (lambda (%) (html:render-multi-mixin (html:render-mixin %))))")
#:start-line 16)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/function-definition-shortcuts.rkt:98:2 (define (multi-html:render-mixin %) (html:render-multi-mixin (html:render-mixin %)))>
#:original-syntax
#<syntax:scribble-lib/scribble/run.rkt:16:0 (define multi-html:render-mixin (lambda (%) (html:render-multi-mixin (html:render-mixin %))))>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/run.rkt>)
#:uses-universal-tagged-syntax? #f)| (map (lambda (fn) | ||
| (let-values ([(base name dir?) (split-path fn)]) | ||
| (or (current-dest-name) name))) | ||
| files) |
There was a problem hiding this comment.
map-to-for: This map operation can be replaced with a for/list loop.
| (map (lambda (fn) | |
| (let-values ([(base name dir?) (split-path fn)]) | |
| (or (current-dest-name) name))) | |
| files) | |
| (for/list ([fn (in-list files)]) | |
| (define-values (base name dir?) (split-path fn)) | |
| (or (current-dest-name) name)) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" (for/list ([fn (in-list files)])"
" (define-values (base name dir?) (split-path fn))"
" (or (current-dest-name) name))")
#:original-lines
'#(" (map (lambda (fn)"
" (let-values ([(base name dir?) (split-path fn)])"
" (or (current-dest-name) name)))"
" files)")
#:start-line 78)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:/home/runner/.local/share/racket/9.4.0.6/pkgs/resyntax/default-recommendations/loops/list-loopification.rkt:125:2 (for/list ((fn (in-list files))) (define-values (base name dir?) (split-path fn)) (or (current-dest-name) name))>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:78:10 (map (lambda (fn) (let-values (((base name dir?) (split-path fn))) (or (current-dest-name) name))) files)>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | ||
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | ||
| [xr (get-xref)]) | ||
| (unless (xref? xr) | ||
| (raise-user-error | ||
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | ||
| (cdr mod+id) (car mod+id) xr)) | ||
| xr)) |
There was a problem hiding this comment.
let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] | |
| [xr (get-xref)]) | |
| (unless (xref? xr) | |
| (raise-user-error | |
| 'scribble "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) (car mod+id) xr)) | |
| xr)) | |
| #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) | |
| (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) | |
| (define xr (get-xref)) | |
| (unless (xref? xr) | |
| (raise-user-error 'scribble | |
| "result from `~s' of `~s' is not an xref: ~e" | |
| (cdr mod+id) | |
| (car mod+id) | |
| xr)) | |
| xr) |
Debugging details
Textual replacement
(line-replacement
#:new-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (define get-xref (dynamic-require (car mod+id) (cdr mod+id)))"
" (define xr (get-xref))"
" (unless (xref? xr)"
" (raise-user-error 'scribble"
" \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id)"
" (car mod+id)"
" xr))"
" xr)")
#:original-lines
'#(" #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))])"
" (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))]"
" [xr (get-xref)])"
" (unless (xref? xr)"
" (raise-user-error"
" 'scribble \"result from `~s' of `~s' is not an xref: ~e\""
" (cdr mod+id) (car mod+id) xr))"
" xr))")
#:start-line 96)Syntactic replacement
(syntax-replacement
#:introduction-scope #<procedure:...and/syntax-local.rkt:149:2>
#:new-syntax
#<syntax:.../resyntax/base.rkt:215:28 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) (define xr (get-xref)) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e...>
#:original-syntax
#<syntax:scribble-lib/scribble/private/build.rkt:96:18 (for/list ((mod+id (in-list (reverse (current-xref-input-modules))))) (let* ((get-xref (dynamic-require (car mod+id) (cdr mod+id))) (xr (get-xref))) (unless (xref? xr) (raise-user-error (quote scribble) "result from `~s' of `~s' is not an xref: ~e" (cdr...>
#:source
(file-source
#<path:/home/runner/work/scribble/scribble/scribble-lib/scribble/private/build.rkt>)
#:uses-universal-tagged-syntax? #f)
We added a small even loop to monitor scribble file changes.
We used
dynamic-rerequireto reload related doc modules